import request from "@/router/axios";
import { baseApi } from "@/config/env";

export const www = () =>
  request({
    url: baseApi + "/",
    method: "get"
  });

export const getProjectList = () =>
  request({
    url: baseApi + "/devops/api/project/list",
    method: "get"
  });

export const getBuildInfo = () =>
  request({
    url: baseApi + "/devops/api/branch/search",
    method: "get"
    // 需要带上参数 ?id=[int]&branch=[develop|master|...]
  });

export const buildApplication = data =>
  request({
    url: baseApi + "/devops/api/build",
    method: "post",
    data,
  });

// 下载镜像
export const getImagePull = () =>
  request({
    url: baseApi + "/devops/api/images/pull",
    method: "get"
  });

export const containersCreate = () =>
  request({
    url: baseApi + "/devops/api/container/create",
    method: "post"
  });

export const containerDelete = () =>
  request({
    url: baseApi + "/devops/api/container/delete",
    method: "get"
  });

export const branchSeach = data =>
  request({
    url: baseApi + "/devops/api/branch/search",
    method: "get",
    params: data
  });

export const getBranchList = () =>
  request({
    url: baseApi + "/devops/api/branch",
    method: "get"
  });
